<?php 
	namespace app\data\model;

	use think\Model;

	/**
	* 商品规格价格模型
	*/
	class ShopGoodsSpec extends Model
	{
		/**
		 * 商品规格价格
		 * @return [type] [description]
		 */
		public function spec_price()
		{
			return $this->belongsTo('ShopGoods','id');
		}

		/**
		 * 该商品所有规格价格信息
		 * @param  [type] $gid [description]
		 * @return [type]      [description]
		 */
		public function all_goods_spec($gid)
		{
			return $this->where('goods_id',$gid)->select();
		}

		/**
		 * 该商品规格价格信息
		 * @param  [type] $gid [description]
		 * @return [type]      [description]
		 */
		public function goods_spec($gid,$path)
		{
			return $this->where('goods_id',$gid)->where('spec_path',$path)->find();
		}
	}